#include <bits/stdc++.h>
#include <string>
using namespace std;

void move(int n, char x, char y)
{
 cout << n << " " << x << "->" << y << endl;
}

void hanoi(int n, char A, char B, char C)
{
  if (n == 1)
  {
    move(n, A, C);
    return;
  }
  hanoi(n - 1, A, C, B);
  move(n, A, C);
  hanoi(n - 1, B, A, C);
}

int main()
{
  int n;
  cin >> n;
  hanoi(n,'A','B','C');
  return 0;
}